﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogisticsModel
{
    /// <summary>
    /// ClassName:Purview
    /// Version:1.0
    /// DateTime:2009/8/12
    /// Remark:实体层-角色权限类
    /// </summary>
    public class Purview
    {
        public Purview(String limit)
        {
            this.limit = limit.ToCharArray();
        }

        /// <summary>
        /// 用户权限字符串
        /// </summary>
        private char[] limit = new char[27];

        /// <summary>
        /// 用户权限字符串
        /// </summary>
        public string Limit
        {
            get { return limit.ToString(); }
            set { limit = value.ToCharArray(); }
        }

        /// <summary>
        /// 重构ToString方法
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return limit.ToString();
        }

        /// <summary>
        /// 运输管理（菜单）
        /// </summary>
        public bool TransportManage
        {
            get { return limit[0] == '1'; }
            set { limit[0] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 车队维护
        /// </summary>
        public bool TruckTeamManage
        {
            get { return limit[1] == '1'; }
            set { limit[1] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 添加车队
        /// </summary>
        public bool AddTruckTeam
        {
            get { return limit[2] == '1'; }
            set { limit[2] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 车辆维护
        /// </summary>
        public bool TruckManage
        {
            get { return limit[3] == '1'; }
            set { limit[3] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 添加车辆
        /// </summary>
        public bool AddTruck
        {
            get { return limit[4] == '1'; }
            set { limit[4] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 驾驶员管理（菜单）
        /// </summary>
        public bool Driver
        {
            get { return limit[5] == '1'; }
            set { limit[5] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 驾驶员维护
        /// </summary>
        public bool DriverManage
        {
            get { return limit[6] == '1'; }
            set { limit[6] = value ? '1' : '0'; }
        }
        /// <summary>
        /// 添加驾驶员
        /// </summary>
        public bool AddDriver
        {
            get { return limit[7] == '1'; }
            set { limit[7] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 运力查询（菜单）
        /// </summary>
        public bool Capacity
        {
            get { return limit[8] == '1'; }
            set { limit[8] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 查询承运车队
        /// </summary>
        public bool TruckTeamQuery
        {
            get { return limit[9] == '1'; }
            set { limit[9] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 查询承运车辆
        /// </summary>
        public bool TruckQuery
        {
            get { return limit[10] == '1'; }
            set { limit[10] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 查询承运单
        /// </summary>
        public bool CarriersQuery
        {
            get { return limit[11] == '1'; }
            set { limit[11] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 承运单管理（菜单）
        /// </summary>
        public bool Carriers
        {
            get { return limit[12] == '1'; }
            set { limit[12] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 承运单维护
        /// </summary>
        public bool CarriersManager
        {
            get { return limit[13] == '1'; }
            set { limit[13] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 添加承运单
        /// </summary>
        public bool AddCarriers
        {
            get { return limit[14] == '1'; }
            set { limit[14] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 接收承运单
        /// </summary>
        public bool CarriersReceive
        {
            get { return limit[15] == '1'; }
            set { limit[15] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 车辆调度（菜单）
        /// </summary>
        public bool Command
        {
            get { return limit[16] == '1'; }
            set { limit[16] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 分配承运任务
        /// </summary>
        public bool CommandTask
        {
            get { return limit[17] == '1'; }
            set { limit[17] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 成本核算（菜单）
        /// </summary>
        public bool Cost
        {
            get { return limit[18] == '1'; }
            set { limit[18] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 成本维护
        /// </summary>
        public bool CostMaintenance
        {
            get { return limit[19] == '1'; }
            set { limit[19] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 成本核算
        /// </summary>
        public bool Costing
        {
            get { return limit[20] == '1'; }
            set { limit[20] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 系统维护（菜单）
        /// </summary>
        public bool SystemManage
        {
            get { return limit[21] == '1'; }
            set { limit[21] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 员工维护
        /// </summary>
        public bool StaffManage
        {
            get { return limit[22] == '1'; }
            set { limit[22] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 添加员工
        /// </summary>
        public bool AddStaff
        {
            get { return limit[23] == '1'; }
            set { limit[23] = value ? '1' : '0'; }
        }

        public bool SearchLog
        {
            get { return limit[24] == '1'; }
            set { limit[24] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 权限设置
        /// </summary>
        public bool PurviewOpera
        {
            get { return limit[25] == '1'; }
            set { limit[25] = value ? '1' : '0'; }
        }

        /// <summary>
        /// 维护时间设置
        /// </summary>
        public bool SysMaintenance
        {
            get { return limit[26] == '1'; }
            set { limit[26] = value ? '1' : '0'; }
        }
    }
}
